<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
  	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<title>${SYSTEM_NAME}</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/layui/css/layui.css?v=${FILE_VERSION}" media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/style/admin.css?v=${FILE_VERSION}" media="all">
  	<!-- 文件上传 -->
  	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/fileUpload.css?v=${FILE_VERSION}">
</head>
<body>
	<div class="layui-fluid" style="background-color: #fff;">
		<form class="layui-form" method="post" id="basicform" >
			<input id="id" name="id" value="${fileEntry.id }" type="hidden">
			
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label layui-form-required">文件名称</label>
				<div class="layui-input-block">
					<input id="name" name="realFileName" placeholder="请输入文件名称"
						class="layui-input" lay-verify="required" value="${fileEntry.realFileName }" maxlength="20">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn layui-btn-primary layui-border-blue" lay-submit="" lay-filter="sub">修改文件名</button>
					<button type="button" class="layui-btn layui-btn-primary layui-border-red" onclick="closed()">关闭</button>
				</div>
			</div>

		</form>
	</div>
	<script src="${pageContext.request.contextPath}/static/js/common-2.0.0.js?v=${FILE_VERSION}"></script>
	<script src="${pageContext.request.contextPath}/static/layuiadmin/layui/layui.js?v=${FILE_VERSION}"></script>
	<script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js?v=${FILE_VERSION}"></script>
	<script>
		layui.use(['form'], function() {
			var form = layui.form;

			form.on('submit(sub)', function(data){
				$ajax({
					url: "/sys/file/renameFile",
					data :  data.field,
			        succCallback: function (json) {
			        	if(json.code == 0){
			        		parent.renameFileBack($("#id").val(),$("#name").val());
		            		parent.layer.closeAll();
		            		parent.layer.msg(json.msg);
			        	}
			        }
				});
				return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
			});
		});
		
		function closed(){
			var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
			parent.layer.close(index);//关闭弹出的子页面窗口
		}
	</script>
</body>
</html>